/*#include<stdio.h>
#include<math.h>
#include<windows.h>
int main()
{
	int end = 1,i,n=100;
	char arrey[4], *name, *s = "sin", *c = "cos", *e = "exp";//保证比较字符串时其参数类型一致
	double proportion=0;
	double (*fun)(double x);				//记得用指针指向函数要打括号
	while (end == 1)
	{
		printf_s("用矩形法求哪一个通用函数的x在[0,1]的定积分？请输入：（sin , cos 或 exp）\n");
		name = arrey;
		
		fflush(stdin);		//丢弃缓存区内的回车
		gets_s(name, 12);
		printf_s("%s(x)在x区间[0,1]上的积分为：\n",name,12);

		//改变函数指针的指向
		if (strcmp(name,s)==0)				//strcmp()对两个字符串进行大小写敏感的比较
		{
			fun = sin;
		}
		else if (strcmp(name, c) == 0)
		{
			fun = cos;
		}
		else if (strcmp(name, e) == 0)
		{
			fun = exp;
		}
		else
		{
			printf_s("暂不提供其他函数积分计算\n");
		}
		//计算
		for (i = 1; i <= 100; i++)
		{
			proportion = proportion + fun(0 + i / n) / n;
		}
		printf_s("%f\n", proportion);

		printf_s("\nenter 1 to continue or enter 0 to end it:");
		scanf_s("%d", &end);
	}
	system("pause");
	return 0;
}*/